package org.tissou.server.Tests;

import junit.framework.TestCase;
import org.tissou.server.Utils.TelechargeurDeTaux;
import org.tissou.client.Services.MonnaieInfos;
import org.tissou.client.Services.TauxConversionInfos;

import java.text.SimpleDateFormat;
import java.text.ParseException;

/**
 * Created by IntelliJ IDEA.
 * User: Manu
 * Date: 14 mars 2009
 * Time: 11:56:35
 * To change this template use File | Settings | File Templates.
 */
public class TelechargeurTauxTest extends TestCase {
  public void testQueCaChoppeBienLeTaux() throws ParseException {
    TelechargeurDeTaux t = new TelechargeurDeTaux();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    TauxConversionInfos taux = t.telechargerTauxPourDate(
        new MonnaieInfos("pound"), new MonnaieInfos("euro"), sdf.parse("2009-01-01"));
    assertEquals(1.0358506f, taux.getTaux());
  }
  
  public void testQueCaRenvoieLeTauxSiDejaDansBaseMySQL() throws ParseException {
    TelechargeurDeTaux t = new TelechargeurDeTaux();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    TauxConversionInfos taux = t.allerChercherTaux(sdf.parse("2009-01-01"), new MonnaieInfos("pound"), new MonnaieInfos("euro"));
    assertEquals(1.03585f, taux.getTaux());
  }

 

  
}